#include<iostream>
#include"bob.h"
#include"alice.h"
#include<fstream>
using namespace std;

long code();

int main(int argc, char * argv){
	BOB Bartek;
	cout << "Enter number to encode. This number only you can see. Number must be from interval 1 - " << Bartek.n-1 << ", because this number must be smaller from random number n.";
	long v;
	cin >> v;
	ALICE Ala(v);

	while(1){
		cout << "\nWhat you want know?\n"
			"\t1. What can see Eva.\n"
			"\t2. What is code from Alice.\n"
			"\t3. Bob can decode number from Alice?\n"
			"\t0. EXIT\n"
			"Choose number:";
		int d;
		cin >> d;
		if(d==0) break;
		else if(d==1) cout << "Eva can see n: " << Ala.n << ", and e " << Ala.e << " from Bob.\n\n";
		else if(d==2) cout << "Alice code witch can see Eva is " << code() << ". This code get Bob.\n\n";
		else if(d==3) cout << "Number witch BOB decode: " << Bartek.decode() << endl << endl;
	}

	
	return 0;
}

long code(){
	std::ifstream DATA;
	DATA.open("code.txt");
	long M;
	DATA >> M;
	DATA.close();
	return M;
}